import java.util.Stack;

public class MyQueue {
    private Stack<Integer> data;
    private Stack<Integer> helper;

    public MyQueue() {
        data = new Stack<>();
        helper = new Stack<>();
    }

    public void push(int x) {
        while (!data.isEmpty()) {
            helper.push(data.pop());
        }
        data.push(x);
        while (!helper.isEmpty()) {
            data.push(helper.pop());
        }

    }

    public int pop() {
        return data.pop();
    }

    public int peek() {
        return data.peek();
    }

    public boolean empty() {
        return data.isEmpty();
    }
}
